﻿using System;

namespace jQueryLib
{
    public abstract partial class JQueryInstance
    {
        /// <summary>
        /// Adds the specified class(es) to each of the set of matched elements.
        /// </summary>
        /// <param name="className">One or more class names to be added to the class attribute of each matched element.</param>
        /// <returns></returns>
        public abstract JQueryInstance AddClass(string className);
        /// <summary>
        /// Adds the specified class(es) to each of the set of matched elements.
        /// </summary>
        /// <param name="func">string function(int index, string currentClass)
        /// <para>index: position in element set</para>
        /// <para>currentClass: the class value of current element</para>
        /// <para>return: class to be add.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance AddClass(Func<string, int, string> func);

        /// <summary>
        /// Remove all classes from each element in the set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract JQueryInstance RemoveClass();

        /// <summary>
        /// Remove classes from each element in the set of matched elements.
        /// </summary>
        /// <param name="className"></param>
        /// <returns></returns>
        public abstract JQueryInstance RemoveClass(string className);

        /// <summary>
        /// Remove classes from each element in the set of matched elements.
        /// </summary>
        /// <param name="func">string function(int index, string currentClass)
        /// <para>index: position in element set</para>
        /// <para>currentClass: the class value of current element</para>
        /// <para>return: class to be remove.</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance RemoveClass(Func<string, int, string> func);

        public abstract bool HasClass(string className);

        /// <summary>
        /// gets the attribute value for only the first element in the matched set.
        /// To get the value for each element individually, use a looping construct such as jQuery's .each() or .map() method.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="attributeName"></param>
        /// <returns></returns>
        public abstract object Attr(string attributeName);

        /// <summary>
        /// Set one or more attributes for the set of matched elements.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="attributeName"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public abstract JQueryInstance Attr(string attributeName, object val);

        /// <summary>
        /// Set one or more attributes for the set of matched elements.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="map">A map of attribute-value pairs to set. Can use anonymous object in C#</param>
        /// <returns></returns>
        public abstract JQueryInstance Attr(object map);

        /// <summary>
        /// Set attributes for the set of matched elements.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="attributeName"></param>
        /// <param name="func">string function(int index, object attrVal)
        /// <para>this keyword in JScript is the current element.</para>
        /// <para>index: position in element set</para>
        /// <para>attrVal: the old attribute value</para>
        /// <para>return: attribute value to be set</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Attr(string attributeName, Func<object, int, object> func);

        /// <summary>
        /// Get the HTML contents of the first element in the set of matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract string Html();

        /// <summary>
        /// Set the HTML contents of each element in the set of matched elements.
        /// </summary>
        /// <param name="htmlSnippet"></param>
        /// <returns></returns>
        public abstract JQueryInstance Html(string htmlSnippet);

        /// <summary>
        /// Set the HTML contents of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">string function(int index, string oldHtml)
        /// <para>this keyword in JScript is the current element.</para>
        /// <para>index: position in element set</para>
        /// <para>oldHtml: the old html string</para>
        /// <para>return: html string to be set</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Html(Func<string, int, string> func);

        /// <summary>
        /// Get the value of a property for the first element in the set of matched elements.
        /// To get the value for each element individually, use a looping construct such as jQuery's .each() or .map() method.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        public abstract object Prop(string propertyName);

        /// <summary>
        /// Set one or more properties for the set of matched elements.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="propertyName"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public abstract JQueryInstance Prop(string propertyName, object value);

        /// <summary>
        /// Set one or more properties for the set of matched elements.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="map">A map of attribute-value pairs to set. Can use anonymous object in C#</param>
        /// <returns></returns>
        public abstract JQueryInstance Prop(object map);

        /// <summary>
        /// Set one or more properties for the set of matched elements.
        /// Notice the difference between attr() and prop()
        /// </summary>
        /// <param name="propertyName"></param>
        /// <param name="func">string function(int index, string oldVal)
        /// <para>this keyword in JScript is the current element.</para>
        /// <para>index: position in element set</para>
        /// <para>oldVal: the old property value</para>
        /// <para>return: value to be set</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Prop(string propertyName, Func<object, int, object> func);

        /// <summary>
        /// Remove an attribute from each element in the set of matched elements.
        /// </summary>
        /// <param name="attributeName"></param>
        /// <returns></returns>
        public abstract JQueryInstance RemoveAttr(string attributeName);

        /// <summary>
        /// Remove a property for the set of matched elements.
        /// </summary>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        public abstract JQueryInstance RemoveProp(string propertyName);

        /// <summary>
        /// Add or remove one or more classes from each element in the set of matched elements
        /// </summary>
        /// <param name="className"></param>
        /// <returns></returns>
        public abstract JQueryInstance ToggleClass(string className);

        /// <summary>
        /// Add or remove one or more classes from each element in the set of matched elements
        /// </summary>
        /// <param name="className"></param>
        /// <param name="toggleSwitch">add(true) or remove(false)</param>
        /// <returns></returns>
        public abstract JQueryInstance ToggleClass(string className, bool toggleSwitch);

        /// <summary>
        /// Add or remove one or more classes from each element in the set of matched elements
        /// </summary>
        /// <param name="func">string function(int index, string oldClass)
        /// <para>index: position in element set</para>
        /// <para>oldClass: the old class value</para>
        /// <para>return: class to be set</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance ToggleClass(Func<string, int, string> func);

        /// <summary>
        /// Add or remove one or more classes from each element in the set of matched elements
        /// </summary>
        /// <param name="func">string function(int index, string oldClass, bool switch)
        /// <para>index: position in element set</para>
        /// <para>oldClass: the old class value</para>
        /// <para>toggleSwitch: toggleSwitch passed in</para>
        /// <para>return: value to be set</para>
        /// </param>
        /// <param name="toggleSwitch"></param>
        /// <returns></returns>
        public abstract JQueryInstance ToggleClass(Func<string, int, string, bool> func, bool toggleSwitch);

        /// <summary>
        /// Get the current value of the first element in the set of matched elements.
        /// Might return array if is selector etc.
        /// </summary>
        /// <returns></returns>
        public abstract object Val();

        /// <summary>
        /// Set the value of each element.
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public abstract JQueryInstance Val(string value);

        /// <summary>
        /// Set the value of each element in the set of matched elements.
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        public abstract JQueryInstance Val(string[] values);

        /// <summary>
        /// Set the value of each element in the set of matched elements.
        /// </summary>
        /// <param name="func">object function(int index, object oldVal)
        /// <para>this keyword in JScript is the current element.</para>
        /// <para>index: position in element set</para>
        /// <para>oldVal: the old value</para>
        /// <para>return: value to be set</para>
        /// </param>
        /// <returns></returns>
        public abstract JQueryInstance Val(Func<object, int, object> func);
    }
}
